import request from "@/common/Ask";
import type { Post } from '@/interface/Post'
import type { Query } from '@/interface/Query'
import type {Page} from "@/interface/Page";

export async function operatorApi( data : Post ) {
    return request<boolean>({
        url: 'post/operator',
        method: 'put',
        data: data
    });
}

export async function listApi( data : Query ) {
    return request<Page<Post>>({
        url: 'post/list',
        method: 'post',
        data: data
    });
}

export async function listAllApi() {
    return request<Post[]>({
        url: 'post/listAll',
        method: 'get'
    });
}


export async function deleteApi( ids : string[] ) {
    return request<boolean>({
        url: 'post/delete',
        method: 'delete',
        data: ids
    });
}


export async function oneId( id : string ) {
    return request<Post>({
        url: 'post/oneId/' + id,
        method: 'get'
    });
}
